package adavance.thread.lockbank;

/**
 * @author oldliu
 * @since 1.0
 */
public class Cunqianren extends Thread {
    private final Account ac;
    public Cunqianren(String name, Account ac){
        super(name);
        this.ac=ac;
    }

    @Override
    public void run() {
        while (true){
            ac.deposit(4500);
            try {
                System.out.println(super.getName()+"存钱4500元，现在余额是 "+ac.getMoney()+"元");
                //synchronized (ac){
                    ac.notifyAll();//all比较好
                //}
                sleep(15000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
